﻿using Taype.Trading.BTC.MtGoxAPIClient.JSONObjects;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using Taype.Trading.BTC.MtGoxAPIClient;

namespace MtGoxAPIClient_test
{
    
    
    /// <summary>
    ///This is b test class for MtGoxTradeTest and is intended
    ///to contain all MtGoxTradeTest Unit Tests
    ///</summary>
    [TestClass()]
    public class MtGoxTradeTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in b class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for MtGoxTrade Constructor
        ///</summary>
        [TestMethod()]
        public void MtGoxTradeConstructorTest()
        {
            MtGoxTrade target = new MtGoxTrade();
            Assert.IsNotNull(target);
        }

        /// <summary>
        ///A test for getObjects
        ///</summary>
        [TestMethod()]
        public void getObjectsMtGoxTradeTest()
        {
            string jsonDataStr = "[{\"date\":1325881442,\"price\":\"6.58329\",\"amount\":\"0.05964\",\"price_int\":\"658329\",\"amount_int\":\"5964000\",\"tid\":\"1325881442939550\",\"price_currency\":\"USD\",\"item\":\"BTC\",\"trade_type\":\"ask\"}]";
            MtGoxTrade expected = new MtGoxTrade();
            expected.date = 1325881442;
            expected.price = 6.58329;
            expected.amount = 0.05964;
            expected.amount_int = 5964000;
            expected.price_int = 658329;
            expected.tid = "1325881442939550";
            expected.item = "BTC";
            expected.price_currency = MtGoxCurrencySymbol.USD;
            expected.trade_type = MtGoxTradeType.ask;
            List<MtGoxTrade> actual;
            actual = MtGoxTrade.getObjects(jsonDataStr);
            Assert.AreEqual(1, actual.Count);
            Assert.AreEqual(expected.amount, actual[0].amount);
            Assert.AreEqual(expected.amount_int, actual[0].amount_int);
            Assert.AreEqual(expected.date, actual[0].date);
            Assert.AreEqual(expected.item, actual[0].item);
            Assert.AreEqual(expected.price, actual[0].price);
            Assert.AreEqual(expected.price_currency, actual[0].price_currency);
            Assert.AreEqual(expected.price_int, actual[0].price_int);
            Assert.AreEqual(expected.primary, actual[0].primary);
            Assert.AreEqual(expected.tid, actual[0].tid);
            Assert.AreEqual(expected.trade_type, actual[0].trade_type);
        }

        /// <summary>
        ///A test for amount
        ///</summary>
        [TestMethod()]
        public void amountTest()
        {
            MtGoxTrade target = new MtGoxTrade();
            double expected = 0.0;
            double actual;
            target.amount = expected;
            actual = target.amount;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for amount_int
        ///</summary>
        [TestMethod()]
        public void amount_intTest()
        {
            MtGoxTrade target = new MtGoxTrade();
            long expected = 0;
            long actual;
            target.amount_int = expected;
            actual = target.amount_int;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for date
        ///</summary>
        [TestMethod()]
        public void dateTest()
        {
            MtGoxTrade target = new MtGoxTrade();
            int expected = 0;
            int actual;
            target.date = expected;
            actual = target.date;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for item
        ///</summary>
        [TestMethod()]
        public void itemTest()
        {
            MtGoxTrade target = new MtGoxTrade();
            string expected = "BTC";
            string actual;
            target.item = expected;
            actual = target.item;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for price
        ///</summary>
        [TestMethod()]
        public void priceTest()
        {
            MtGoxTrade target = new MtGoxTrade();
            double expected = 7.99;
            double actual;
            target.price = expected;
            actual = target.price;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for price_currency
        ///</summary>
        [TestMethod()]
        public void price_currencyTest()
        {
            MtGoxTrade target = new MtGoxTrade();
            MtGoxCurrencySymbol expected = MtGoxCurrencySymbol.USD;
            MtGoxCurrencySymbol actual;
            target.price_currency = expected;
            actual = target.price_currency;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for price_int
        ///</summary>
        [TestMethod()]
        public void price_intTest()
        {
            MtGoxTrade target = new MtGoxTrade();
            long expected = 412345;
            long actual;
            target.price_int = expected;
            actual = target.price_int;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for primary
        ///</summary>
        [TestMethod()]
        public void primaryTest()
        {
            MtGoxTrade target = new MtGoxTrade();
            string expected = "Y";
            string actual;
            target.primary = expected;
            actual = target.primary;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for tid
        ///</summary>
        [TestMethod()]
        public void tidTest()
        {
            MtGoxTrade target = new MtGoxTrade();
            string expected = "TEST-TEST-TEST-TEST";
            string actual;
            target.tid = expected;
            actual = target.tid;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for trade_type
        ///</summary>
        [TestMethod()]
        public void trade_typeTest()
        {
            MtGoxTrade target = new MtGoxTrade();
            MtGoxTradeType expected = MtGoxTradeType.ask;
            MtGoxTradeType actual;
            target.trade_type = expected;
            actual = target.trade_type;
            Assert.AreEqual(expected, actual);
        }
    }
}
